package o;

import com.huawei.appgallery.foundation.account.bean.UserSession;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;

public class car {
    private static car ॱ;
    private Map<String, String> ˊ = Collections.synchronizedMap(new cas(20, 0.25f, true));
    private boolean ˎ = false;

    public static synchronized car ˏ() {
        car o_car;
        synchronized (car.class) {
            if (ॱ == null) {
                ॱ = new car();
            }
            o_car = ॱ;
        }
        return o_car;
    }

    private car() {
    }

    public void ˎ() {
        if (UserSession.getInstance().isLoginSuccessful() && !ˊ()) {
            String ˊ = cat.ˋ().ˊ();
            if (ˊ != null) {
                for (Object put : ˊ.split(",")) {
                    this.ˊ.put(put, null);
                }
            }
            ˊ(true);
            bqx.ˏ("PostIdCacheManager", "initCache");
        }
    }

    public void ॱ(long j) {
        if (UserSession.getInstance().isLoginSuccessful()) {
            this.ˊ.put(String.valueOf(j), null);
            Iterator it = this.ˊ.keySet().iterator();
            StringBuilder stringBuilder = new StringBuilder();
            boolean hasNext = it.hasNext();
            while (hasNext) {
                stringBuilder.append((String) it.next());
                hasNext = it.hasNext();
                if (!hasNext) {
                    break;
                }
                stringBuilder.append(",");
            }
            cat.ˋ().ॱ(stringBuilder.toString());
        }
    }

    public boolean ˊ(long j) {
        return this.ˊ.containsKey(String.valueOf(j));
    }

    public void ˋ() {
        bqx.ˏ("PostIdCacheManager", "clear");
        this.ˊ.clear();
        ˊ(false);
    }

    public synchronized boolean ˊ() {
        return this.ˎ;
    }

    public synchronized void ˊ(boolean z) {
        this.ˎ = z;
    }
}
